<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<table width="680" border="0" cellspacing="0" cellpadding="0"  id="tableformDangNhap">
    <tr align="center" valign="middle" bgcolor="#FF0000">
        <td  bgcolor="#FF0000" height="30" colspan="2" class="menu1">SẢN PHẨM</td>
    </tr>
    <tr align="left" valign="middle">
        <td id="tdformDangNhap" height="25" colspan="2" bgcolor="#55BFFF" style="font-weight: bold">
            Kết quả tìm kiếm cho từ khóa ${param.tukhoa}
        </td>
    </tr>
    <tr>
        <td id="tdformDangNhap" width="70%">
            Trang 
            <c:forEach var="i" begin="1" end="${soTrang}"
                       step="1" >
                <a style="color:#00C" href="TimKiemNhanh.do?&tukhoa=${param.tukhoa}&trang=${i}&soLuongSanPhamTrenTrang=${soLuongSanPhamTrenTrang}">${i}</a> 
                <c:if test="${i < soTrang}" >
                    |
                </c:if>
            </c:forEach>
        </td>
        <td  width="30%" align="right">
            <form name="frmSoSanPhamTrenTrang" action="TimKiemNhanh.do" method="get">
                <input  name="tukhoa"  type="hidden" value="${param.tukhoa}" />
                <label for="soLuongSanPhamTrenTrang">Số lượng</label>
                <select name="soLuongSanPhamTrenTrang" onchange="submit()">
                    <c:forEach var="i" begin="1" end="5">
                        <option 
                            <c:if test="${i*2 == soLuongSanPhamTrenTrang}" >
                                selected="selected"
                            </c:if>
                            value="${i*2}">${i*2}</option>
                    </c:forEach>
                    <option
                        <c:if test="${soLuongSanPhamTrenTrang}==-1" >
                            selected="selected"
                        </c:if>
                        value="-1">Tất cả</option>
                </select>
            </form>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <table width="100%" border="0" cellspacing="0" cellpadding="5">
                <c:forEach var="i" begin="0" end="${dssp.size()-1}" step="1">
                    <c:set var="sp" value="${dssp.get(i)}"/>

                    <tr>
                        <td width="20%" rowspan="4" valign="top"><a href="ChiTietSanPham.jsp?MaSanPham=${sp.getMaSanPham()}"><img src="${sp.getHinhAnh()}" width="125" height="125" alt="Click để xem chi tiết"/></a></td>
                        <td colspan="2"><b><a href="ChiTietSanPham.jsp" title="Click xem chi tiết sản phẩm" class="sanpham_link">
                                    ${sp.getTenSanPham()}$</a></b></td>
                    </tr>

                    <tr >
                        <td  style="padding-left: 10px;" width="160" >

                            <c:forEach var="p" begin="1" end="${sp.diemDanhGia}" step="1">
                                <div id="star-${p}" class="rating-on"></div>
                            </c:forEach>
                            <c:forEach var="p" begin="${sp.diemDanhGia}" end="4" step="1">
                                <div id="star-${p}" class="rating-off"></div>
                            </c:forEach>

                        </td>
                        <td rowspan="2" style="text-align:left;"  >${sp.getMoTa().substring(1, 150)}...</td>
                    </tr>
                    <tr>
                        <td clas="gia_cell"><fmt:formatNumber type="currency" value="${sp.donGia}" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="left" clas="gia_cell" style="background-color:#cad9ed">
                            <a href="GioHang.do?Action=DatMua&MaSanPham=${sp.getMaSanPham()}&SoLuong=1" style="color:#0762A2;"><input  type="button" value="" style="background-image:url(images/AddToCart_new.jpg); background-repeat:no-repeat; width:150px; height:30px;" /></a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </td>
    </tr>              
</table>
